package mbsdk

//	MBSDKDroneFlight
//	@Description: 大疆MBSDK推送的无人机的实时数据
//
// @Time 2024-06-04 10:35:38
type MBSDKDroneFlight struct {
	Model                             string             `json:"Model"`
	Warns                             string             `json:"Warns"`
	SN                                string             ` json:"sn"` // 无人机设备号
	TrackId                           string             ` json:"track_id"`
	Latitude                          float64            `json:"latitude"`
	Longitude                         float64            `json:"longitude"`
	Altitude                          float64            `json:"altitude"`
	Height                            float64            `json:"height"`
	Pitch                             float64            `json:"pitch"`
	Roll                              float64            `json:"roll"`
	Head                              float64            `json:"head"`
	Vx                                float64            `json:"vx"`
	Vz                                float64            `json:"vz"`
	RthAltitude                       int64              `json:"rth_altitude"` //返航高度
	RcLostAction                      int64              `json:"rc_lost_action"`
	WindSpeed                         float64            `json:"wind_speed"` //风速	float	r	0	{"min":"-1.4E-45","max":"3.4028235E38","unit":"m/s","unitName":"米每秒","step":"0.1"}
	WindDirection                     int64              `json:"wind_direction"`
	HomeLongitude                     float64            `json:"home_longitude"`
	HomeLatitude                      float64            `json:"home_latitude"`
	HomeDistance                      float64            `json:"home_distance"`
	TotalFlightSorties                int                `json:"total_flight_sorties"` //飞行器累计飞行总架次；只读。定频
	NightLightsState                  int                `json:"night_lights_state"`
	ControlSource                     string             `json:"control_source"`                        //负载控制权
	LowBatteryWarningThreshold        int                `json:"low_battery_warning_threshold"`         //低电量告警
	SeriousLowBatteryWarningThreshold int                `json:"serious_low_battery_warning_threshold"` //严重低电量告警
	TotalFlightTime                   float32            `json:"total_flight_time"`                     //飞行器累计飞行航时；只读。定频
	TotalFlightDistance               float32            `json:"total_flight_distance"`                 //飞行器累计飞行距离；只读。定频
	HeightLimit                       int                `json:"height_limit"`
	IsNearHeightLimit                 int                `json:"is_near_height_limit"`
	IsNearAreaLimit                   int                `json:"is_near_area_limit"`
	RthMode                           int                `json:"rth_mode"`
	CurrentRthMode                    int                `json:"current_rth_mode"`
	SimCardState                      int                `json:"sim_card_state"`
	PositionState                     PositionStateItems `json:"position_state"` //搜星状态
	Storage                           StorageItem        `json:"storage"`        //存储容量；只读；定频
	Battery                           BatteryItem        `json:"battery"`        //飞行器电池信息；只读；定频
	Gimbal                            []GimbalItem       `json:"gimbal"`
	ObstacleAvoidance                 ObstacleAvoidance  `json:"obstacle_avoidance"`
	Cameras                           []camerasItem      `json:"cameras"`
	Elevation                         string             `json:"elevation"` //相对起飞的高度；只读。定频
	ModeCode                          int                `json:"mode_code"` //	飞行器状态 只读。定频
	JobNumber                         int                `json:"job_number"`
	FlyTime                           int                `json:"fly_time"`
	FlyDis                            int                `json:"fly_dis"`
	DatalinkSignal                    int                `json:"datalink_signal"`
	RtkNumber                         int                `json:"rtkNumber"` //RTK 搜星数量
}

type camerasItem struct {
	PayloadIndex        string      `json:"payload_index"`
	CameraMode          int         `json:"camera_mode"`
	PhotoState          int         `json:"photo_state"`
	ScreenSplitEnable   interface{} `json:"screen_split_enable"`
	RecordingState      int         `json:"recording_state"`
	ZoomFactor          float32     `json:"zoom_factor"`
	ZoomFocusState      int         `json:"zoom_focus_state"`
	IrMeteringMode      int         `json:"ir_metering_mode"` //红外测温模式
	VideoType           string      `json:"video_type"`       //相机类型
	LiveviewWorldRegion struct {
		Left   float64 `json:"left"`
		Top    float64 `json:"top"`
		Right  float64 `json:"right"`
		Bottom float64 `json:"bottom"`
	} `json:"liveview_world_region"`
	IrZoomFactor    float32 `json:"ir_zoom_factor"`
	IrMeteringPoint struct {
		X           float64 `json:"x"`
		Y           float64 `json:"y"`
		Temperature float64 `json:"temperature"`
	} `json:"ir_metering_point"`
	IrMeteringArea struct {
		X               float64 `json:"x"`
		Y               float64 `json:"y"`
		Width           float64 `json:"width"`
		Height          float64 `json:"height"`
		AverTemperature float64 `json:"aver_temperature"`
	} `json:"ir_metering_area"`
	MinTemperaturePoint struct {
		X           float64 `json:"x"`
		Y           float64 `json:"y"`
		Temperature float64 `json:"temperature"`
	} `json:"min_temperature_point"`
	MaxTemperaturePoint struct {
		X           float64 `json:"x"`
		Y           float64 `json:"y"`
		Temperature float64 `json:"temperature"`
	} `json:"max_temperature_point"`
}
type ObstacleAvoidance struct {
	Horizon  int `json:"horizon"`
	Upside   int `json:"upside"`
	Downside int `json:"downside"`
}
type PositionStateItems struct {
	IsFixed   int `json:"is_fixed"`   //是否收敛	{"0":"非开始","1":"收敛中","2":"收敛成功","3":"收敛失败"}
	Quality   int `json:"quality"`    //搜星档位	{"1":"1档","2":"2档","3":"3档","4":"4档","5":"5档"}
	GpsNumber int `json:"gps_number"` //GPS 搜星数量
	RtkNumber int `json:"rtk_number"` //RTK 搜星数量
}

type StorageItem struct {
	Total int `json:"total"` //总容量；{"min":"-2147483648","max":"2147483647","unit":"KB","unitName":"千字节","step":"1"}
	Used  int `json:"used"`  //已使用容量{"min":"-2147483648","max":"2147483647","unit":"KB","unitName":"千字节","step":"1"}
}

type BatteryItem struct {
	CapacityPercent  int             `json:"capacity_percent"`   //总剩余电量 {"min":0,"max":100}
	RemainFlightTime int             `json:"remain_flight_time"` //剩余飞行时间 {"unit":"秒"}
	ReturnHomePower  int             `json:"return_home_power"`  //返航所需电量百分比 {"min":0,"max":100}
	LandingPower     int             `json:"landing_power"`      //强制降落电量百分比{"min":0,"max":100}
	Batteries        []BatteriesItem `json:"batteries"`          //电池详细信息
}
type BatteriesItem struct {
	CapacityPercent        int     `json:"capacity_percent"`          //电池剩余电量 //{"min":0,"max":100}
	Index                  int     `json:"index"`                     //电池序号;{"min":"0"}
	Sn                     string  `json:"sn"`                        //电池编号
	Type                   int     `json:"type"`                      //电池类型
	SubType                int     `json:"sub_type"`                  //电池子类型
	FirmwareVersion        string  `json:"firmware_version"`          //电池固件版本
	LoopTimes              int     `json:"loop_times"`                //电池循环次数
	Voltage                int     `json:"voltage"`                   //电压{"unit":"毫伏"}
	Temperature            float32 `json:"temperature"`               //温度{"unit":"摄氏度"}
	HighVoltageStorageDays int     `json:"high_voltage_storage_days"` //高电压存储天数{"unit":"天"}
}

type GimbalItem struct {
	Pitch        float64          `json:"pitch"`
	Roll         float64          `json:"roll"`
	Yaw          float64          `json:"yaw"`
	LaserMeasure LaserMeasureItem `json:"laser_measure"`
}
type LaserMeasureItem struct {
	MeasureTargetLongitude  float64 `json:"measure_target_longitude"`
	MeasureTargetLatitude   float64 `json:"measure_target_latitude"`
	MeasureTargetAltitude   float64 `json:"measure_target_altitude"`
	MeasureTargetDistance   float64 `json:"measure_target_distance"`
	MeasureTargetErrorState float64 `json:"measure_target_error_state"`
}

type State struct {
	DroneSn string `json:"droneSn"`
	State   int    `json:"state"`
}
